﻿<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Admin/Masters/Admin.master" CodeBehind="UserControlEditor.aspx.vb" Inherits="Boogaloo.Admin.UI.Webpages.UserControlEditor" 
    title="Mindfly Web Studio's Boogaloo - Host - Freehand Controls" validaterequest="false" %>
<%@ register tagprefix="boogaloo" assembly="Boogaloo.Admin" namespace="Boogaloo.Admin.UI.Controls" %> 
<%@ import namespace="Boogaloo.Core.UI" %>

<script runat="server">
    '
    ' Boogaloo® - http://www.mindfly.com
    ' Copyright (c) 2008
    ' by Mindfly, Inc.
    '
    ' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
    ' documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
    ' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
    ' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
    '
    ' The above copyright notice and this permission notice shall be included in all copies or substantial portions 
    ' of the Software.
    '
    ' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
    ' INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    ' DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    ' SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    ' SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    ' WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    ' THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    
    
    ''' <summary>
    ''' Modify this routine if you want to add more templates
    ''' Template directory ~/App_Data/CodeTemplates/    
    ''' filename is created from linkbutton commandarguement    
    ''' </summary>
    Private Sub lb_source_Click(ByVal sender As Object, ByVal e As EventArgs) _
        Handles lb_custom.Click, lb_list.Click, lb_nodeinfo.Click
        
        txt_ascx.Text = String.Empty
        
        Dim lb As LinkButton = CType(sender, LinkButton)
               
        txt_ascx.Text = Groove.GetTextFileContents(String.Format("{0}/{1}.config", code_template_directory, lb.CommandArgument.ToLower))
          
        ulCodeTemplates.Visible = False
        
    End Sub
    
 
    
</script>
<asp:content id="MainContent" contentplaceholderid="MainContent" runat="server">

<h3>User Control Editor</h3>

<asp:updatepanel id="up" runat="server">
<contenttemplate>
    <div id="box clear">
    <h4>What Control Would You Like To Work With?</h4>
    <asp:label id="lbl_ddl_ascx" runat="server" associatedcontrolid="ddl_ascx">
    <asp:dropdownlist id="ddl_ascx" runat="server" autopostback="true" CssClass="small" />    
    </asp:label>

    
 
    <fieldset id="fld_editor" runat="server">
    <h4>What would you like to name this new file?</h4>
    <asp:label id="lbl_txt_ascx_name" runat="server" associatedcontrolid="txt_ascx_name">
    
    <asp:textbox id="txt_ascx_name" runat="server" CssClass="medium" />
    <asp:requiredfieldvalidator id="rfv_txt_ascx_name" runat="server" controltovalidate="txt_ascx_name" errormessage="A <em>unique</em> file name is required." display="Dynamic" />    
    </asp:label><asp:label id="lbl_fileexists" runat="server" text="<strong><em>A file with this name already exists</em></strong>" visible="false" />
 
    <div id="designer_info" runat="server">
        <h5>Information for your web designer</h5>
        <asp:label id="lbl_register" runat="server" /><br />
        <asp:label id="lbl_callout" runat="server" />
    </div>
    
    <ul id="ulCodeTemplates" class="codeTemplateList list plain" runat="server">
        <li><h4>What would you like to do with this new control?</h4></li>
            <li>
            <asp:linkbutton id="lb_nodeinfo" commandargument="usercontrol_nodeobject" runat="server" text="<h5>I want to create a control that has a 'Node' object property.</h5>" causesvalidation="false" />
            <div class="explanation">
            This option is generally a good selection if:
            <ul>
                <li>You need to make a custom menu item for a list control.</li>
                <li>You need to have information about a page (Node) formatted with custom styles</li>
            </ul>
            <div>
        </li>
        <li>
            <asp:linkbutton id="lb_list" runat="server" commandargument="usercontrol_simplerepeater" text="<h5>Generate an ASP.NET repeater contruct to create a quick list</h5>" causesvalidation="false" />            
        </li>
        <li>
            <asp:linkbutton id="lb_custom" runat="server" commandargument="usercontrol_custom"  text="<h5>Just generate a blank ASCX file ... I know what I am doing.</h5>" causesvalidation="false" />
        </li>
    </ul>
    
    <div class="box enriched alt">
        <asp:label id="lbl_txt_ascx" runat="server" associatedcontrolid="txt_ascx">
            <h5>ASCX file contents</h5>
            <asp:textbox id="txt_ascx" runat="server" textmode="MultiLine" rows="25" width="700px" />
        
        </asp:label>
    </div>
    
    <asp:linkbutton id="lb_save" class="button enriched" runat="server" text="Save this file" />&nbsp;&nbsp;
    
    <asp:hyperlink id="hyp_cancel" class="button enriched" runat="server" text="Cancel" />
    <br /><br />
    <boogaloo:commitwizard id="dwiz" runat="server" cssclass="warning wizard" start_text="<span class='button enriched'>Delete this control</span>" message="<p>Are you certain you want to delete this control?</p><p>Deleting this control may cause problems if it is still referenced anywhere in the site layouts</p><p>This action cannot be reversed.</p>" commit_text="Do it already" cancel_text="Cancel" />
    
    </fieldset>
 
    
 
 </div>
 </contenttemplate>
</asp:updatepanel>


</asp:content>

